import Vue from 'vue'
import Router from 'vue-router'
import Login from './views/Login.vue'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
        path: '/',
        component: () => import(/* webpackChunkName: "about" */ './views/Main.vue'),
        meta: { requireAuth: true },
        redirect: { path: '/home' },
        children: [
            {
                path: '/home',
                component: () => import(/* webpackChunkName: "about" */ './components/Home.vue'),
                name: 'home'
            },
            {
                path: '/courselist',
                component: () => import(/* webpackChunkName: "about" */ './components/course/CourseList.vue'),
                name: '课程列表'
            },
            {
                path: '/courseadd',
                component: () => import(/* webpackChunkName: "about" */ './components/course/CourseAddForm.vue'),
                name: '课程新增'
            },
            {
                path: '/courseedit',
                component: () => import(/* webpackChunkName: "about" */ './components/course/CourseEditForm.vue'),
                name: '课程编辑'
            },
            {
                path: '/teacherlist',
                component: () => import(/* webpackChunkName: "about" */ './components/teacher/TeacherList.vue'),
                name: '老师列表'
            },
            {
                path: '/teacheradd',
                component: () => import(/* webpackChunkName: "about" */ './components/teacher/TeacherAddForm.vue'),
                name: '老师新增'
            },
            {
                path: '/teacheredit',
                component: () => import(/* webpackChunkName: "about" */ './components/teacher/TeacherEditForm.vue'),
                name: '老师编辑'
            },
            {
                path: '/about',
                name: 'about',
                component: () => import(/* webpackChunkName: "about" */ './views/About.vue')
            },
            {
                path: '/err',
                name: '404页面',
                component: () => import(/* webpackChunkName: "about" */ './components/common/404.vue')
            },
            // {
            //     path: '/home',
            //     component: (resolve) => {require(['@/views/pages/Home'], resolve)},
            //     name: '主页'
            // },
            // {
            //   path: '/table',
            //   name: '表格',
            //   component: (resolve) => { require(['@/views/pages/01/table'], resolve) }
            // },
            // {
            //     path: '/form',
            //     name: '表单',
            //     component: (resolve) => { require(['@/views/pages/02/form'], resolve) }
            // },
            // {
            //     path: '/chart',
            //     name: '图表',
            //     component: (resolve) => { require(['@/views/pages/03/chart'], resolve) }
            // }
        ]
    },
  ]
})
